{{template "main-top" .}}

<div class="head">
    <h1>{{t "InitMFAU2F.Title"}}</h1>

    {{ template "user-profile" . }}

    <p>{{t "InitMFAU2F.Description"}}</p>
</div>

<form action="{{ mfaInitU2FVerifyUrl }}" method="POST">

    {{ .CSRF }}

    <input type="hidden" name="authRequestID" value="{{ .AuthReqID }}" />
    <input type="hidden" name="credentialCreationData" value="{{ .CredentialCreationData }}" />
    <input type="hidden" name="credentialData" />

    <div class="fields">
        <p class="wa-no-support lgn-error hidden">{{t "InitMFAU2F.NotSupported"}}</p>
        <div class="field wa-support">
            <label class="lgn-label" for="name">{{t "InitMFAU2F.TokenNameLabel"}}</label>
            <input class="lgn-input" type="text" id="name" name="name" autocomplete="off" autofocus>
        </div>
        <div id="wa-error" class="lgn-error hidden">
            <span class="cause"></span>
            <span>{{t "InitMFAU2F.ErrorRetry"}}</span>
        </div>
    </div>

    {{ template "error-message" .}}

    <div class="lgn-actions">
        <!-- position element in header -->
        <a class="lgn-icon-button lgn-left-action" href="{{ mfaPromptChangeUrl .AuthReqID .MFAType }}">
            <i class="lgn-icon-arrow-left-solid"></i>
        </a>

        <span class="fill-space"></span>
        <button type="submit" id="btn-register" class="lgn-raised-button lgn-primary wa-support">{{t "InitMFAU2F.RegisterTokenButtonText"}}</button>
    </div>
</form>

<script src="{{ resourceUrl "scripts/utils.js" }}"></script>
<script src="{{ resourceUrl "scripts/webauthn.js" }}"></script>
<script src="{{ resourceUrl "scripts/webauthn_register.js" }}"></script>

{{template "main-bottom" .}}
